//package com.dunshan.dunshanfile.config;
//
//import jdk.nashorn.internal.runtime.logging.Logger;
//import org.slf4j.MDC;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.stereotype.Component;
//import org.springframework.web.filter.GenericFilterBean;
//
//import javax.servlet.FilterChain;
//import javax.servlet.ServletException;
//import javax.servlet.ServletRequest;
//import javax.servlet.ServletResponse;
//import javax.servlet.http.HttpServletRequest;
//import java.io.IOException;
//
///**
// * @author .dunshan
// * @program: dunshan-pef
// * @description:
// * @date 2021-11-10 23:42:44
// */
//@Component
//public class MyFilter extends GenericFilterBean {
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        HttpServletRequest request = (HttpServletRequest) servletRequest;
//        String flag = request.getHeader("flag");
//        if (StringUtils.isNotBlank(flag)) {
//            MDC.put("dunshan", "shadow");
//            logger.info("flag：" + flag);
//        } else {
//            MDC.put("dunshan", "produce");
//
//        }
//        filterChain.doFilter(servletRequest, servletResponse);
//    }
//
//    @Override
//    public void destroy() {
//        MDC.clear();
//    }
//
//}
